//
//  HJBaseTableViewController.m
//  12期传智微博HJ
//
//  Created by mac on 15-2-3.
//  Copyright (c) 2015年 jun. All rights reserved.
//

#import "HJBaseTableViewController.h"
#import "HJNavigationController.h"
#import "HJAccount.h"
#import "HJOAuthViewController.h"

@interface HJBaseTableViewController ()<HJDefaultCenterViewDelegate>

@end

@implementation HJBaseTableViewController
- (void)loadView
{
    //取出存储的模型对象
    HJAccount *account = [HJAccount accountFromSandbox];
    //判断是否授权
    if (account != nil) {
        //已经授权
        [super loadView];
    }else//没有授权
    {
    HJDefaultCenterView *defaultCenterView = [HJDefaultCenterView defaultCenterView];
    self.view = defaultCenterView;
    self.defaultCenterView = defaultCenterView;
    self.defaultCenterView.delegate = self;
    }
}

#pragma mark - CZDefaultCenterViewDelegate
- (void)defaultCenterView:(HJDefaultCenterView *)defaultCenterView didClickLogin:(UIButton *)loginBtn
{
    //创建导航控制器
    HJNavigationController *nav = [[HJNavigationController alloc]init];
    //创建授权控制器
    HJOAuthViewController *OAuthVc = [[HJOAuthViewController alloc]init];
    [nav addChildViewController:OAuthVc];
    //弹出授权控制器
    [self presentViewController:nav animated:YES completion:nil];
    
}

- (void)defaultCenterView:(HJDefaultCenterView *)defaultCenterView didClickRegister:(UIButton *)registerBtn
{
    
}

@end
